package com.hollycrm.hollysqm.analyzer.solr.factory;

import com.hollycrm.hollysqm.analyzer.ansj.AnsjAnalysis;
import org.apache.lucene.analysis.Analyzer;

/**
 * Created by zhaihw on 2016/5/4.
 * 提供给solr分词使用的
 */
public class SolrIndexAnalyzer extends Analyzer {
    private static AnsjAnalysis analyzer = new AnsjAnalysis();
    public SolrIndexAnalyzer(){
        super();
    }
    /**
     * Creates a new {@link TokenStreamComponents} instance for this analyzer.
     *
     * @param fieldName the name of the fields content passed to the
     *                  {@link TokenStreamComponents} sink as a reader
     * @return the {@link TokenStreamComponents} for this analyzer.
     */
    @Override
    protected TokenStreamComponents createComponents(String fieldName) {

        return analyzer.createComponents(fieldName);
    }
}
